import { handleActions } from 'redux-actions'

interface ActionInterface {
    type: string;
    data?: any;
}
const initState = {
    cityList: [],
    weather: {},
    postion: {}
}
const homeReducer = handleActions({
    CityList(state: any, action: ActionInterface) {
        return {
            ...state,
            cityList: action.data.result,
        }
    },
    WeatherInfo(state: any, action: ActionInterface) {
        return {
            ...state,
            weather: action.data,
        }
    },
    GeographicalLocation(state: any, action: ActionInterface) {
        return {
            ...state,
            postion: action.data,
        }
    }
}, initState)
export default homeReducer;
